package com.ruoyi.web.controller.app;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Hgtcrawlers;
import com.ruoyi.system.service.IHgtcrawlersService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 招标信息Controller
 * 
 * @author ruoyi
 * @date 2024-01-26
 */
@RestController
@RequestMapping("/system/hgtcrawlers")
public class HgtcrawlersController extends BaseController
{
    @Autowired
    private IHgtcrawlersService hgtcrawlersService;

    /**
     * 查询招标信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:hgtcrawlers:list')")
    @GetMapping("/list")
    public TableDataInfo list(Hgtcrawlers hgtcrawlers)
    {
        startPage();
        List<Hgtcrawlers> list = hgtcrawlersService.selectHgtcrawlersList(hgtcrawlers);
        return getDataTable(list);
    }

    /**
     * 导出招标信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:hgtcrawlers:export')")
    @Log(title = "招标信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Hgtcrawlers hgtcrawlers)
    {
        List<Hgtcrawlers> list = hgtcrawlersService.selectHgtcrawlersList(hgtcrawlers);
        ExcelUtil<Hgtcrawlers> util = new ExcelUtil<Hgtcrawlers>(Hgtcrawlers.class);
        util.exportExcel(response, list, "招标信息数据");
    }

    /**
     * 获取招标信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:hgtcrawlers:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(hgtcrawlersService.selectHgtcrawlersById(id));
    }

    /**
     * 新增招标信息
     */
    @PreAuthorize("@ss.hasPermi('system:hgtcrawlers:add')")
    @Log(title = "招标信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Hgtcrawlers hgtcrawlers)
    {
        return toAjax(hgtcrawlersService.insertHgtcrawlers(hgtcrawlers));
    }

    /**
     * 修改招标信息
     */
    @PreAuthorize("@ss.hasPermi('system:hgtcrawlers:edit')")
    @Log(title = "招标信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Hgtcrawlers hgtcrawlers)
    {
        return toAjax(hgtcrawlersService.updateHgtcrawlers(hgtcrawlers));
    }

    /**
     * 删除招标信息
     */
    @PreAuthorize("@ss.hasPermi('system:hgtcrawlers:remove')")
    @Log(title = "招标信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(hgtcrawlersService.deleteHgtcrawlersByIds(ids));
    }
}
